package com.ronan.common.codec;

import com.ronan.common.protocol.RIMProtocol;
import io.netty.buffer.ByteBuf;
import io.netty.channel.ChannelHandler;
import io.netty.channel.ChannelHandlerContext;
import io.netty.handler.codec.MessageToMessageDecoder;

import java.util.List;

/**
 * FileName    : com.ronan.imserver.codec
 * Description : 解码器
 *
 * @author : ysk
 * @version : 1.0
 * Create Date : 2021/2/26 0:26
 **/
@ChannelHandler.Sharable
public class RIMProtocolDecoder extends MessageToMessageDecoder<ByteBuf> {
    @Override
    protected void decode(ChannelHandlerContext ctx, ByteBuf buf, List<Object> out) throws Exception {
        RIMProtocol protocol = new RIMProtocol();
        protocol.decode(buf);
        out.add(protocol);
    }
}
